package com.atguigu.yygh.controller;

import com.atguigu.yygh.result.Result;
import com.atguigu.yygh.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zr
 * @date 2021/12/14 19:40
 */
@Api(tags = "科室列表")
@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {
    @Resource
    private DepartmentService departmentService;

    /**
     * 根据医院编号，查询医院所有科室列表
     */
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hosCode}")
    public Result getDeptList(@PathVariable String hosCode) {
        List<DepartmentVo> departmentVos = departmentService.findDeptTree(hosCode);
        return Result.ok(departmentVos);
    }
}
